import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    logs:[]
  },
  mutations: {
    setLogs(state,log){
      state.logs.push(log);
    },
    deleteLogs(state,log){
      state.logs = log
    }
  },
  actions: {
    changeLogs ({commit}, logs ) {
      // eslint-disable-next-line
      return new Promise(function (resolve, reject) {
        commit('setLogs', logs);
      })
    },
    deleteLogs ({commit} ) {
      // eslint-disable-next-line
      return new Promise(function (resolve, reject) {
        commit('deleteLogs', []);
      })
    },
  },
  modules: {
  }
})
